#include "iRegstryAssist.h"

iRegstryAssist::iRegstryAssist(void)
{
}

iRegstryAssist::~iRegstryAssist(void)
{
}

bool iRegstryAssist::SetAniRegistry( char* pRegName, int nType, LPBYTE datas, size_t size )
{
	HKEY KeyData; 
	LONG lResult  = RegConnectRegistry( NULL, HKEY_LOCAL_MACHINE, &KeyData );
	if ( lResult != ERROR_SUCCESS )
		return false;


	//memset( NameBuffer, 0, sizeof(TCHAR) * 128 );
	//_tcscpy_s( NameBuffer, 128, MAX_GAMEANI_REGPATH );
	//_tcscat_s( NameBuffer, _T("\\REG_STEP") );
	//RegOpenKeyEx( KeyData, NameBuffer, 0, KEY_ALL_ACCESS, NULL );
	//RegSetValueEx( KeyData, _T("REG_STEP"), 0, REG_DWORD, (LPBYTE)&nFrameStep, sizeof(int) );

	DWORD nDisp = KEY_ALL_ACCESS;
	lResult  = RegOpenKeyEx( HKEY_LOCAL_MACHINE, MAX_GAMEANI_REGPATH, 0, KEY_ALL_ACCESS, &KeyData );
	if( lResult != ERROR_SUCCESS )
		RegCreateKeyEx(HKEY_LOCAL_MACHINE, MAX_GAMEANI_REGPATH, 0, NULL, REG_OPTION_NON_VOLATILE
		, KEY_ALL_ACCESS, NULL, &KeyData, &nDisp );
	
	// Setting Type
	RegSetValueEx( KeyData, pRegName, 0, nType, datas, size );
	return true;
}